package derivable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Disjunction implements Derivable<Disjunction> {
	private List<Disjunction> conjunctions = new ArrayList<>();

	public Disjunction(final List<Disjunction> conjunctions) {
		this.conjunctions = conjunctions;
	}
	public Disjunction(final Disjunction... conjunctions) {
		final List<Disjunction> list = new ArrayList<>();
		Collections.addAll(list, conjunctions);
		this.conjunctions = list;
	}
	@Override
	public boolean derives(final Disjunction o) {
		for (final Disjunction ownD : getConjunctions()) {
			for (final Disjunction otherD : o.getConjunctions()) {
				if (ownD.derives(otherD)) {
					return true;
				}
			}
		}
		return false;
	}
	public List<Disjunction> getConjunctions() {
		return conjunctions;
	}
	public void setConjunctions(final List<Disjunction> conjunctions) {
		this.conjunctions = conjunctions;
	}
}
